package SecondSaturday;

import java.awt.Point;

public class CopyArray {
	public CopyArray(){
		Point p = new Point();
			p.x=100;
			p.y=200;
			
			Point temp = (Point)p.clone(); // clone의 반환형이 object 이므로 Point 형으로 캐스팅 해줌.
			temp.x=300;
			temp.y=400;

			System.out.println("p.x = " + p.x);
			System.out.println("p.y = " + p.y);
			
			System.out.println("temp.x = " + temp.x);
			System.out.println("temp.y = " + temp.y);
			
		
	}
	public static void main(String[] args) {
		CopyArray ca = new CopyArray();
	}
	
	class Point implements Cloneable{
		int x;
		int y;
		public Object clone(){
			Object o = null;
			try{
				o=super.clone();
			}catch(Exception ex){				
			}
			return o;
		}
	}

}
